<template>
  <div v-if="visible" class="modal-overlay">
    <div class="modal-container">
      <div class="modal-header">
        <div class="modal-title">{{ title }}</div>
        <div class="modal-close" @click="closeModal">×</div>
      </div>
      <div class="modal-content">
        <!-- <dv-border-box-9 class="tech-border"> -->
        <div class="tech-border">
          <slot></slot>
        </div>
        <!-- </dv-border-box-9> -->
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "ModalDialog",
  props: {
    visible: {
      type: Boolean,
      default: false,
    },
    title: {
      type: String,
      default: "详细信息",
    },
  },
  methods: {
    closeModal() {
      console.log("关闭按钮被点击");
      this.$emit("close");
    },
  },
};
</script>

<style scoped lang="scss">
// 大屏可视化风格弹窗样式
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 10, 52, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease;
}

.modal-container {
  width: 60%;
  max-width: 800px;
  background: linear-gradient(135deg, #0a1628 0%, #1e3a5f 100%);
  border: 2px solid #00eaff;
  border-radius: 8px;
  box-shadow: 0 0 30px rgba(0, 234, 255, 0.5),
    inset 0 0 20px rgba(0, 234, 255, 0.1);
  position: relative;
  animation: slideIn 0.4s ease;

  &::before {
    content: "";
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #00eaff, #006ced, #00eaff);
    border-radius: 8px;
    z-index: -1;
    animation: borderGlow 3s linear infinite;
  }
}

.modal-header {
  height: 40px;
  background: linear-gradient(90deg, #006ced 0%, #00eaff 100%);
  border-radius: 6px 6px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  border-bottom: 2px solid #00eaff;

  .modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 234, 255, 0.8);
  }

  .modal-close {
    font-size: 24px;
    color: #fff;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;

    &:hover {
      background: rgba(255, 255, 255, 0.2);
      transform: rotate(90deg);
    }
  }
}

.modal-content {
  // padding: 0px 5px;
  padding: 10px;
  min-height: 340px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.tech-border {
  width: 100%;
  height: 100%;
  min-height: 280px;
  // padding: 15px;

  border: 1px solid #00eaff;
  border-radius: 4px;
  background: rgba(0, 234, 255, 0.05);
  position: relative;
  padding: 5px;

  &::before,
  &::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    border: 2px solid #00eaff;
  }

  &::before {
    top: -5px;
    left: -5px;
    border-right: none;
    border-bottom: none;
  }

  &::after {
    bottom: -5px;
    right: -5px;
    border-left: none;
    border-top: none;
  }
}

// 动画效果
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateY(-50px) scale(0.9);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes borderGlow {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}
</style>
